home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 32
/
Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso
/
Aminet
/
dev
/
lang
/
Python152_Src.lha
/
Python152_Source
/
Modules
/
cryptmodule.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-04-25
|
752b
|
48 lines
/* cryptmodule.c - by Steve Majewski
*/
#include "Python.h"
#include <sys/types.h>
#ifdef AMITCP
#include <proto/usergroup.h>
#endif
#ifdef INET225
#include <proto/socket.h>
static __inline STRPTR crypt(STRPTR pw, STRPTR un)
{
static char buf[32];
return s_crypt(buf,pw,un);
}
#endif
#include "protos/cryptmodule.h"
/* Module crypt */
static PyObject *crypt_crypt(self, args)
PyObject *self, *args;
{
char *word, *salt;
extern char * crypt();
if (!PyArg_Parse(args, "(ss)", &word, &salt)) {
return NULL;
}
return PyString_FromString( crypt( word, salt ) );
}
static PyMethodDef crypt_methods[] = {
{"crypt", crypt_crypt},
{NULL, NULL} /* sentinel */
};
DL_EXPORT(void)
initcrypt()
{
Py_InitModule("crypt", crypt_methods);
}